﻿using System.Collections.Generic;
using System.Xml;

namespace QDT.Payment.AllInPay.Api
{
    /// <summary>
    /// 交易返回报文类
    /// </summary>
    public class TradeResponse : Response
    {
        List<RetDetailResponse> details;
        /// <summary>
        /// 解释响应XML报文文本，生成报文对象
        /// </summary>
        /// <param name="xmlText">响应XML报文文本</param>
        internal override void ParseXML(string xmlText)
        {
            base.ParseXML(xmlText);
            details = new List<RetDetailResponse>();
            foreach (XmlNode detailNode in m_elBody.SelectSingleNode("./RET_DETAILS/RET_DETAIL"))
            {
                details.Add(new RetDetailResponse(detailNode));
            }
        }
        /// <summary>
        /// 解释响应XML报文对象，生成报文对象
        /// </summary>
        /// <param name="xmlDoc">响应XML报文对象</param>
        internal override void ParseXML(XmlDocument xmlDoc)
        {
            base.ParseXML(xmlDoc);
            details = new List<RetDetailResponse>();
            foreach (XmlNode detailNode in m_elBody.SelectNodes("./RET_DETAILS/RET_DETAIL"))
            {
                details.Add(new RetDetailResponse(detailNode));
            }
        }
        /// <summary>
        /// 获取交易明细状态
        /// </summary>
        public RetDetailResponse[] Details
        {
            get { return details.ToArray(); }
        }
    }
}
